package com.nbcb.nwql.common.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.nbcb.nwql.applicantion.domain.MyExcelImport;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Data
@Slf4j
public class ImportListenUtil extends CommonAnalysisListen<MyExcelImport> {

    private List<MyExcelImport> myExcelImports;

    public ImportListenUtil(List<MyExcelImport> myExcelImports) {
        this.myExcelImports = myExcelImports;
    }

    @Override
    public void invoke(MyExcelImport myExcelImport, AnalysisContext analysisContext) {

        myExcelImports.add(myExcelImport);
    }

    @Override
    public void onException(Exception exception, AnalysisContext context) throws Exception {
        System.out.println(exception.getMessage());
    }
}
